//
//  HDChangePhoneSuccessViewController.swift
//  HuaDaoPeifu
//
//  Created by 刘汉琳 on 16/9/7.
//  Copyright © 2016年 paiyipai. All rights reserved.
//

import UIKit

class HDChangePhoneSuccessViewController: UIViewController {
    
    var iconImageView = UIImageView()
    var successLabel = UILabel()
    var messageLabel = UILabel()
    var finishBtn = UIButton()
    var phoneNumber = String()

    override func viewDidLoad() {
        super.viewDidLoad()
        title = "绑定完成"
        view.backgroundColor = UIColor(hex:0xF7F7F7)
        createIconImageView()

    }
    
    func createIconImageView(){
        view.addSubview(iconImageView)
        iconImageView.snp.makeConstraints { (make) in
            make.top.equalTo(57)
            make.left.equalTo((AppConstant.screenWidth - 69)/2)
            make.width.equalTo(69)
            make.height.equalTo(75)
        }
        iconImageView.image = UIImage(named: "icon_complete")
        
        createMessageView()
    }
    
    func createMessageView(){
        view.addSubview(successLabel)
        successLabel.snp.makeConstraints { (make) in
            make.top.equalTo(iconImageView.snp.bottom).offset(25)
            make.left.equalTo(0)
            make.width.equalTo(16)
            make.right.equalTo(0)
        }
        successLabel.text = "手机号绑定完成"
        successLabel.font = UIFont.systemFont(ofSize: 16)
        successLabel.textColor = UIColor(hex:0x333333)
        successLabel.textAlignment = .center
        
        view.addSubview(messageLabel)
        messageLabel.snp.makeConstraints { (make) in
            make.top.equalTo(successLabel.snp.bottom).offset(10)
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.height.equalTo(14)
        }
        messageLabel.textColor = UIColor(hex:0x666666)
        messageLabel.font = UIFont.systemFont( ofSize: 14)
        messageLabel.textAlignment = .center
    
        messageLabel.text = "再次登录账号：" + (phoneNumber as NSString).replacingCharacters(in: NSMakeRange(3, 4), with: "****") + ",密码不变"
        
        view.addSubview(finishBtn)
        finishBtn.snp.makeConstraints { (make) in
            make.top.equalTo(messageLabel.snp.bottom).offset(56)
            make.left.equalTo(view).offset(40)
            make.right.equalTo(view).offset(-40)
            make.height.equalTo(40)
        }
        finishBtn.setTitle("完成", for: UIControlState())
        finishBtn.setTitleColor(UIColor.white, for: UIControlState())
        finishBtn.backgroundColor = ConstantColor.appThemeColor
        finishBtn.layer.cornerRadius = 2.5
        finishBtn.addTarget(self, action: #selector(HDChangePhoneSuccessViewController.btnClick), for: .touchUpInside)
        
    }
    
    
    func btnClick(){
        navigationController?.popToRootViewController(animated: true)
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    

}
